import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;




/**
 * A singleton class for loading resources
 * @author Peter
 *
 */
public class ResourceManager {

	/**
	 * The only instance
	 */
	private static ResourceManager mInstance = new ResourceManager();

	/**
	 * Default constructor, can not be called publicly
	 */
	private ResourceManager() {}

	/**
	 * Static method returning the only instance of this singleton
	 * 
	 */
	public static ResourceManager getInstance() {
		return mInstance;
	}

	public static String readStringResource(String file) throws IOException {
		InputStream is = getInstance().getClass().getResourceAsStream(file);
		String string ="";
		String line = "";
		BufferedReader br = new BufferedReader(new InputStreamReader(is));
		while((line=br.readLine()) !=null)
		{
			string+=line;
		}
		is.close();
		return string;
	}
	
}



